package com.wenson.behavior.state;

/**
 * @ClassName: Switcher
 * @Author: luowangcheng
 * @Date: 2024/6/15 20:31
 * @Description:
 */
public class Switcher {
    private boolean state = false;

    public void switchOn(){
        if (!state){
            state = true;
            System.out.println("OK...使灯亮");
        } else{
            System.out.println("ERROR!!开启状态下无需再开启");
        }
    }

    public void switchOff(){
        if (state){
            state = false;
            System.out.println("OK...使灯灭");
        }else{
            System.out.println("ERROR!!关闭状态下无需再关闭");
        }
    }
}
